from queue import Queue
from threading import Thread
from PoseStream import getPoseStream
from MatchGestrue import matchGesture
from ParseGesture import parseGestures, data2userCode
from globalvar import switch

# 用来表示终止的特殊对象
_sentinel = object()
poses_q = Queue()
switch('VIEW_HANDS')
def printGesture(poses_in_queue, END_SIG):
    while True:
        data = poses_in_queue.get()
        if data is END_SIG:
            poses_in_queue.put(END_SIG)
            break
        else:
            if data:
                print("收到", data2userCode(data))


t1 = Thread(target=printGesture, args=(poses_q, _sentinel))
t2 = Thread(target=getPoseStream, args=(poses_q, _sentinel))
t1.start()
t2.start()